import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class DonationBoxTest {

	DonationBox sallyAnne;
	
	@Before
	public void setUp() throws Exception {
		sallyAnne = new DonationBox("Salvation Army");
	}

	@Test
	public void initializedCorrectly() {
		String name = sallyAnne.getCharityName();
		assertTrue(name.equals("Salvation Army"));
		
		int total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 0);
	}
	
	@Test
	public void firstDonationWorks() {
		sallyAnne.donate(10);
		int total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 10);
	}
	
	@Test
	public void multipleDonationsWork() {
		sallyAnne.donate(10);
		
		sallyAnne.donate(20);
		int total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 10 + 20);
		
		
		sallyAnne.donate(15);
		total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 10 + 20 + 15);
	}
	
	@Test
	public void noNegativeDonations() {
		sallyAnne.donate(10);
		
		sallyAnne.donate(-5);
		int total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 10);		
	}
	
	@Test
	public void noBigDonations() {
		sallyAnne.donate(10);
		
		sallyAnne.donate(999999999);
		int total = sallyAnne.getTotalDonationsInPennies();
		assertTrue(total == 10);	
	}
}
